using GamFi.Admin.API.Application.Interfaces;
using GamFi.Admin.API.Domain.Entities;
using GamFi.Admin.API.Persistence.Configurations;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace GamFi.Admin.API.Persistence.Context;

public class EfContext : IdentityDbContext<User, Role, Guid>, IDbContext
{
    /// <summary>
    /// Пустой конструктор
    /// </summary>
    public EfContext()
    {
    }

    /// <summary>
    /// Конструктор
    /// </summary>
    public EfContext(DbContextOptions options)
        : base(options)
    {
    }
    
    /// <inheritdoc />
    public DbSet<Chain> Chains { get; set; }

    /// <inheritdoc />
    public DbSet<Country> Countries { get; set; }

    /// <inheritdoc />
    public DbSet<Image> Images { get; set; }

    /// <inheritdoc />
    public DbSet<UserInfo> UserInfos { get; set; }
    
    /// <inheritdoc />
    public DbSet<Wallet> Wallets { get; set; }
    
    /// <inheritdoc />
    public DbSet<Transaction> Transactions { get; set; }
    
    /// <inheritdoc />
    public DbSet<Token> Tokens { get; set; }
    
    /// <inheritdoc />
    public DbSet<Purchase> Purchases { get; set; }
    
    /// <inheritdoc />
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new ChainConfiguration());
        modelBuilder.ApplyConfiguration(new CountryConfiguration());
        modelBuilder.ApplyConfiguration(new PurchaseConfiguration());
        modelBuilder.ApplyConfiguration(new RoleConfiguration());
        modelBuilder.ApplyConfiguration(new TokenConfiguration());
        modelBuilder.ApplyConfiguration(new TransactionConfiguration());
        modelBuilder.ApplyConfiguration(new UserConfiguration());
        modelBuilder.ApplyConfiguration(new UserInfoConfiguration());
        modelBuilder.ApplyConfiguration(new WalletConfiguration());
        
        base.OnModelCreating(modelBuilder);
    }
}